﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            uiTextBox1.Text = "hello world";
            uiListBox1.Items.Add("篮球");
            uiListBox1.Items.Add("羽毛球");
            uiListBox1.Items.Add("乒乓球");
            uiListBox1.Width = 100;
            uiListBox1.Height = 400;
            uiListBox1.AutoSize = true;
            uiCheckBox1.Text = "爱好";

            uiScrollingText1.Text = "一段文字一段文字一段文字一段文字一段文字一段文字一段文字一段文字一段文字";
            uiScrollingText1.TextAlign = ContentAlignment.TopLeft;
            uiScrollingText1.Width = 400;
            uiScrollingText1.Active = true;

            uiComboBox1.Items.Add("篮球");
            uiComboBox1.Items.Add("羽毛球");
            uiComboBox1.Items.Add("兵乓球");
            uiComboBox1.SelectedIndex = 0;
        }

        private void uiListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            object selectedItem = uiListBox1.SelectedItem;
            int selectedIndex = uiListBox1.SelectedIndex;
            string v = uiListBox1.GetItemText(selectedIndex);
            MessageBox.Show(selectedIndex+":"+v);
        }

        private void uiComboBox1_TextChanged(object sender, EventArgs e)
        {
            int selectedIndex = uiComboBox1.SelectedIndex;
            if(selectedIndex > -1)
            {
                object v = uiComboBox1.Items[selectedIndex];
                MessageBox.Show(selectedIndex + ":"+v);
            }
            
        }
    }
}
